package com.gaojian.topic.one;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author gaojian
 * @version 2024-1-16
 */
public class GaoCallable implements Callable<String> {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        final FutureTask<String> task = new FutureTask<>(new GaoCallable());
        final Thread thread = new Thread(task);
        thread.start();
        final String result = task.get();
        System.out.println(result);
    }

    @Override
    public String call() {
        return "GaoCallable";
    }
}
